from django.db import models

# Create your models here.
class User(models.Model):
    name = models.CharField(max_length=20,verbose_name="用户名称")
    psaaword = models.CharField(max_length=10,verbose_name="用户密码")
    def __str__(self):
        return self.name
    class Meta:
        db_table = 'user'

class News(models.Model):
    title = models.CharField(max_length=20,verbose_name="新闻标题")
    img = models.CharField(max_length=200,verbose_name="新闻图片")
    content = models.CharField(max_length=50,verbose_name="新闻内容")
    read = models.IntegerField(default=0,verbose_name="阅读量")
    def __str__(self):
        return self.title
    class Meta:
        db_table = 'news'

class Messgae(models.Model):
    uname = models.ForeignKey(User,on_delete=models.CASCADE)
    news = models.ForeignKey(News,on_delete=models.CASCADE)
    message = models.CharField(max_length=300,verbose_name="用户评论")
